package jpb.util;

import com.google.gson.Gson;
import jpb.constant.Reply;
import org.apache.poi.ss.formula.functions.T;

/**
 * Created by haol on 2017/4/10.
 */
public class GsonUtil {
        private static Gson gson = new Gson();

        public static String toJson(Object o){
                return gson.toJson(o);
        }

        public static String toJson(int code,String msg){
                Reply reply = new Reply(code,msg);
                return gson.toJson(reply);
        }

        public static String toJson(Reply reply){
                return gson.toJson(reply);
        }

        public static Object fromJson(String text,Class<T> tClass){
                return   gson.fromJson(text,tClass);
        }
}
